//
//  ReadThreeImageTableViewCell.m
//  SuperNews
//
//  Created by dllo on 16/1/11.
//  Copyright © 2016年 qiang. All rights reserved.
//

#import "ReadThreeImageTableViewCell.h"

#define PAD 10

@interface ReadThreeImageTableViewCell ()

@property (nonatomic, strong) UIImageView *imageV;

@end

@implementation ReadThreeImageTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubviews];
    }
    return self;
}

- (void)createSubviews
{
    self.backgroundColor = [UIColor whiteColor];
    self.imageVBig = [UIImageView new];
//    self.imageVBig.backgroundColor = [UIColor redColor];
    [self.contentView addSubview:self.imageVBig];
    
    self.imageVUp = [UIImageView new];
//    self.imageVUp.backgroundColor = [UIColor greenColor];
    [self.contentView addSubview:self.imageVUp];
    
    self.imageVDown = [UIImageView new];
//    self.imageVDown.backgroundColor = [UIColor blueColor];
    [self.contentView addSubview:self.imageVDown];
    
    self.labelTitle = [UILabel new];
//    self.labelTitle.backgroundColor = [UIColor grayColor];
    [self.contentView addSubview:self.labelTitle];
    
    self.labelForm = [UILabel new];
//    self.labelForm.backgroundColor = [UIColor yellowColor];
    self.labelForm.textColor = [UIColor colorWithRed:0.6941 green:0.6905 blue:0.6977 alpha:1.0];
    self.labelForm.font = [UIFont systemFontOfSize:13.0];
    [self.contentView addSubview:self.labelForm];
    
    self.imageV = [UIImageView new];
    self.imageV.image = [UIImage imageNamed:@"recommendlist_cell_close"];
    [self.contentView addSubview:self.imageV];
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    [self.labelTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView.mas_top).mas_offset(PAD);
        make.left.equalTo(self.contentView.mas_left).mas_offset(PAD);
        make.right.equalTo(self.contentView.mas_right).mas_offset(-PAD);
        make.bottom.equalTo(self.imageVBig.mas_top).mas_offset(-PAD);
        make.height.mas_equalTo(30);
    }];
    [self.imageVBig mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.labelTitle.mas_bottom).mas_offset(PAD);
        make.left.equalTo(self.contentView.mas_left).mas_offset(PAD);
        make.right.equalTo(self.imageVUp.mas_left).mas_offset(-PAD / 2.0);
        make.bottom.equalTo(self.labelForm.mas_top).mas_offset(-PAD);
        make.width.mas_equalTo(200);
    }];
    [self.imageVUp mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.labelTitle.mas_bottom).mas_offset(PAD);
        make.left.equalTo(self.imageVBig.mas_right).mas_offset(PAD / 2.0);
        make.right.equalTo(self.contentView.mas_right).mas_offset(-PAD);
        make.bottom.equalTo(self.imageVDown.mas_top).mas_offset(-PAD / 2.0);
        make.height.mas_equalTo(110);
    }];
    [self.imageVDown mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.imageVUp.mas_bottom).mas_offset(PAD / 2.0);
        make.left.equalTo(self.imageVBig.mas_right).mas_offset(PAD / 2.0);
        make.right.equalTo(self.contentView.mas_right).mas_offset(-PAD);
        make.bottom.equalTo(self.labelForm.mas_top).mas_offset(-PAD);
    }];
    
    [self.labelForm mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.imageVBig.mas_bottom).mas_offset(PAD);
        make.left.equalTo(self.contentView.mas_left).mas_offset(PAD);
        make.right.equalTo(self.imageV.mas_left).mas_offset(-PAD);
        make.bottom.equalTo(self.contentView.mas_bottom).mas_offset(-PAD);
    }];
    [self.imageV mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.imageVBig.mas_bottom).mas_offset(PAD);
        make.left.equalTo(self.labelForm.mas_right).mas_offset(PAD);
        make.right.equalTo(self.contentView.mas_right).mas_offset(-PAD);
        make.bottom.equalTo(self.contentView.mas_bottom).mas_offset(-PAD);
        make.height.mas_equalTo(15);
        make.width.mas_equalTo(20);
    }];
}

@end
